package com.octo.poker.data;

public enum CardColor {

	SPADES(0, "S"),
	HEART(1, "H"),
	DIAMONDS(2, "D"),
	CLUBS(3, "C");

	private Integer value;
	private String code;

	private CardColor(int value, String code) {
		this.value = value;
		this.code = code;
	}

	public Integer getValue() {
		return value;
	}

	@Override
	public String toString() {
		return code;
	}

	public static CardColor parse(String s) {
		for (CardColor cardColor : CardColor.values()) {
			if (cardColor.code.equals(s)) {
				return cardColor;
			}
		}
		return null;
	}

}